package com.snail.service.impl;

import com.snail.mapper.BizOrderDetailMapper;
import com.snail.mapper.BizOrderMapper;
import com.snail.model.pojo.cart.BizOrder;
import com.snail.model.pojo.cart.BizOrderDetail;
import com.snail.service.BizOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class BizOrderDetailServiceImpl implements BizOrderDetailService {
    @Autowired
    private BizOrderDetailMapper bizOrderDetailMapper;
    @Autowired
    private BizOrderMapper bizOrderMapper;

    @Override
    public BizOrder selectDetailByOrderNo(String orderNo) {
        List<BizOrderDetail> bizOrderDetails = bizOrderDetailMapper.selectDetailByOrderNo(orderNo);
        //根据订单编号查询订单信息
        BizOrder bizOrder = bizOrderMapper.selectByOrderNo(orderNo);
        //把详情信息放入订单表的引入字段中
        bizOrder.setBizOrderDetails(bizOrderDetails);
        return bizOrder;

    }
}
